<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ include file="../common/header.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page isELIgnored="false" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath }"></c:set>
<script src="js/jquery-3.5.1.js" type="text/javascript"></script>
<!-- 增加页面开始 -->
<div class="x_content">
    <form class="form-horizontal form-label-left" id="query"
          action="marketTypeStudentServlet.do?param=modify" method="post" novalidate>
        <span class="section">市场类型学生修改页面</span>
        <input type="hidden" name="id" value="${marketStudentInfo.id}">
        <input type="hidden" name="pageIndex" value="${pageIndex}">
        <input type="hidden" name="namec" value="${namec}">
        <input type="hidden" name="classname" value="${classname}">
        <input type="hidden" name="stuType" value="${stuType}">
        <input type="hidden" name="intention" value="${intention}">
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">姓名
                <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <input type="text" id="name" name="name"
                       data-validate-linked="email" required="required"
                       class="form-control col-md-7 col-xs-12" value="${marketStudentInfo.studentName}">
            </div>
        </div>

        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">市场类型
                <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <select name="marketType" id="marketType" required="required"
                        class="form-control col-md-7 col-xs-12">
                    <option value="">---请选择---</option>
                    <c:forEach var="type" items="${typeList}">
                        <option value="${type}"
                                <c:forEach var="marketClass" items="${marketClassList}">
                                    <c:if test="${marketClass.mkClassId==marketStudentInfo.mkClassId}">
                                        selected
                                    </c:if>
                                </c:forEach>
                        >${type}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12">班级
                <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <select name="classId" id="classname" required="required"
                        class="form-control col-md-7 col-xs-12">
                    <option value="">---请选择---</option>
                    <c:forEach var="stu" items="${marketClassList}">
                        <option value="${stu.mkClassId}"
                                <c:forEach var="marketClass" items="${marketClassList}">
                                    <c:if test="${marketClass.mkClassId==marketStudentInfo.mkClassId}">
                                        selected
                                    </c:if>
                                </c:forEach>
                        >${stu.className}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12"
            >来自学校 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <input id="fromschool" type="text" name="fromschool"
                       data-validate-length-range="5,20" required="required"
                       class="optional form-control col-md-7 col-xs-12" value="${marketStudentInfo.fromSchool}">
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">学历(大专/本科)<span
                    class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <select name="education" id="education" required="required"
                        class="form-control col-md-7 col-xs-12" value="${marketStudentInfo.education}">
                    <option value="">---请选择---</option>
                    <option value="专科"
                            <c:if test="${marketStudentInfo.education eq '专科'}">
                                selected
                            </c:if>
                    >专科</option>
                    <option value="本科"
                            <c:if test="${marketStudentInfo.education eq '本科'}">
                                selected
                            </c:if>
                    >本科</option>
                </select>
            </div>
        </div>

        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12"
            >电话 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <input id="phone" type="text" name="phone"
                       data-validate-length-range="5,20" required="required"
                       class="optional form-control col-md-7 col-xs-12" value="${marketStudentInfo.phone}">
            </div>
        </div>

        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12"
            >QQ <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <input id="QQ" type="text" name="QQ"
                       data-validate-length-range="5,20" required="required"
                       class="optional form-control col-md-7 col-xs-12" value="${marketStudentInfo.qq}">
            </div>
        </div>

        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">性格特点<span
                    class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <select name="character" id="character" required="required"
                        class="form-control col-md-7 col-xs-12">
                    <option value="">---请选择---</option>
                    <c:forEach var="character" items="${characterList}">
                        <option value="${character}" ${character == marketStudentInfo.xinGe?'selected':''}>${character}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12"
            >备注 <span class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <input id="remarks" type="text" name="remarks"
                       data-validate-length-range="5,20" required="required"
                       class="optional form-control col-md-7 col-xs-12" value="${marketStudentInfo.beiZhu}">
            </div>
        </div>

        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">培训意向<span
                    class="required">*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-12">
                <select name="intention_cha" id="intention" required="required"
                        class="form-control col-md-7 col-xs-12">
                    <option value="">---请选择---</option>
                    <c:forEach var="intention_val" items="${intentionList}">
                        <option value="${intention_val}" ${intention_val==marketStudentInfo.willTrain?'selected':''}>${intention_val}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-6 col-md-offset-3">
                <input type="submit" value="提交" class="btn btn-primary" />
                <button type="reset" class="btn btn-success">重置</button>
                <a href="marketTypeStudentServlet.do?param=cha&pageIndex=${pageIndex}&namec=${namec}&classname=${classname}&stuType=${stuType}&intention=${intention}" id="send" type="button"
                   class="btn btn-success">取消</a>
            </div>
        </div>
    </form>
</div>
<!-- 增加页面结束 -->
<%@ include file="../common/footer.jsp"%>
<%--<script src="${ctx }/statics/localjs/appinfoList.js"></script>--%>
<script src="${ctx }/statics/localjs/marketStuAdd.js"></script>
<script>
    $(function (){
        $("#marketType").change(function(){
            var stuType=$("#marketType").val();
            if (null!=stuType&&stuType!="") {
                $.ajax({
                    type:"POST",//提交方式，默认GET
                    url:"marketStudentAjax.do?operation=class",//提交的服务器地址
                    data:"stuType="+stuType,
                    dataType:"json",
                    success:function(data){
                        $("#classname").html("");
                        var options="<option value='' >---请选择---</option>";
                        for(var i=0;i<data.length;i++){
                            options+="<option value='"+data[i].mkClassId+"' >"+data[i].className+"</option>";
                        }
                        $("#classname").html(options);
                    },
                    error:function(){
                        alert('加载二级菜单失败！');
                        location.href="401.jsp"
                    }
                });
            }else{
                $("#classname").html("");
                var options="<option value='' >---请选择---</option>";
                $("#classname").html(options);
            }
        });
    });
</script>